/**
 * @Project TMHSC
 * @Author Tran Manh Hung
 * @Email: hungtmit@gmail.com | tmh@xwebgate.com
 * @Copyright © 2011 TMH. All rights reserved
 * @Createdate Feb 26, 2011
 * @Createtime 4:41:32 PM
 */

package com.tmh.study.aS3DP.mcv.weatherMap
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;

	public class Model extends EventDispatcher implements IModel
	{
		protected var aRegions:Array;

		protected var chosenRegion:uint;

		protected var aImageURLs:Array;

		public function Model()
		{
			super();

			this.aRegions = new Array("East Coast", "West Coast", "Puerto Rico", "Alaska", "Hawaii");
			this.aImageURLs = new Array("http://www.goes.noaa.gov/GIFS/ECVS.JPG", "http://www.goes.noaa.gov/GIFS/WCVS.JPG", "http://www.goes.noaa.gov/GIFS/PRVS.JPG", "http://www.goes.noaa.gov/GIFS/ALVS.JPG", "http://www.goes.noaa.gov/GIFS/HAVS.JPG");
			this.chosenRegion = 0;
		}

		public function getRegionList():Array
		{
			return aRegions;
		}

		public function getRegion():uint
		{
			return chosenRegion;
		}

		public function setRegion(index:uint):void
		{
			chosenRegion = index;
			update();
		}

		public function getMapURL():String
		{
			return aImageURLs[chosenRegion];
		}

		protected function update():void
		{
			dispatchEvent(new Event(Event.CHANGE)); // dispatch event
		}
	}
}